Improve which-key--any-match-p
authorJustin Burkett <justin@burkett.cc>
Tue, 18 Apr 2017 12:01:40 +0000 (08:01 -0400)
committerJustin Burkett <justin@burkett.cc>
Tue, 18 Apr 2017 12:01:40 +0000 (08:01 -0400)
which-key.el

index 825e1cb0377b31c22cb99e377aea2d46b0e1bcdc..6cc4fd9fc316d68b34f5a5b3313660c7830f993a 100644 (file)
@@ -2023,11 +2023,10 @@ prefix) if `which-key-use-C-h-commands' is non nil."
 
 (defun which-key--any-match-p (regexps string)
   "Non-nil if any of REGEXPS match STRING."
-  (let (match)
+  (catch 'match
     (dolist (regexp regexps)
       (when (string-match-p regexp string)
-        (setq match t)))
-    match))
+        (throw 'match t)))))
 
 (defun which-key--try-2-side-windows (keys page-n loc1 loc2 &rest _ignore)
   "Try to show KEYS (PAGE-N) in LOC1 first. Only if no keys fit fallback to LOC2."